<style lang="stylus" scoped>
    .input-box{
      box-sizing: border-box;
      margin: 10px 15px;
      /* width:100%; */
      height: 33px;
      background: rgba(255,255,255,1);
      line-height: 33px;
    }
  .data-li{
    background: rgba(255,255,255,1);
    margin: 12px 15px;
    padding:18px 15px;
  }
  .li-center{
    margin-left: 15px;
  }
</style>
<template>
  <div class="box">
    <div>
      <ul>
        <li
          v-for="(item,index) in teamList"
          class="flex-display data-li"
          @click="fnChoosePerson(item)"
        >
          <div>
            <img
              :src="item?item.headimgurl:''"
              alt=""
              style="width:48px;height:48px;border-radius: 50%;"
            />
          </div>
          <div class="li-center flex-column-between">
            <p>{{ item ? item.nickname : "" }}</p>
            <p>{{ item ? item.userid : "" }}</p>
          </div>
        </li>
      </ul>
    </div>
    <!-- 没有列表，显示暂无内容 -->
    <div v-if="!teamList.length > 0">
      <img
        src="../../../static/new/img_empty_order@2x.png"
        alt=""
        style="width: 100%;height:400px;"
      />
      <p class="text-c">目前您没有下级人员</p>
    </div>
  </div>
</template>
<script>
  import axios from "axios";
  import {} from "mint-ui";
  import Scroll from "@/base/scroll/scroll";
  import api from "@/fetch/api";
  export default {
    name: "chooseperson",
    components: {},
    data() {
      return {
        teamList: [],
        ethelWxUserInfo: this.$store.state.userInfo
      };
    },
    created() {
      this.getTeam();
      document.title = "请选择接收人";
    },
    mounted() {},
    methods: {
      
      /**
       * @desc    选择人员
       * @author  ye
       * @param   none
       */
      fnChoosePerson(item) {
        // 存入本地
        this.setlocalStorage("assignor", item);
        this.$router.go(-1);
      },

      /**
       * @desc    获取团队列表
       * @author  ye
       * @param   none
       */
      getTeam() {
        const params = {
          // 测试
          // userid:190210,
          userid: this.ethelWxUserInfo.id
        };
        // 获取团队列表
        api.subuser(params).catch(res => {
          // console.log('获取团队列表', res);
          this.teamList = res.data.data;
        });
      }
    }
  };
</script>
